<template>
	<view class="approval">
		<view class="tabList">
			<!-- <u-tabs item-width="350" height="80" bar-width="80" :list="tabList" :is-scroll="true" :current="tabCurrent"
				@change="tabChange"></u-tabs> -->
			<v-tabs v-model="tabCurrent" :scroll="false" :tabs="tabList" @change="tabChange" ></v-tabs>
		</view>
		<view class="" style="display: flex;justify-content: center;align-items: center;height: 100vh;"
			v-if="loading==true">
			<u-loading mode="flower" show size="100rpx"></u-loading>
		</view>

		<view class="main" v-else>
			<mescroll-list :fixed="false" :down="mescrollDown" :up="mescrollUp" ref="mescrollRef" @init="mescrollInit"
				v-if="tabCurrent==0" @down="downCallback" @up="upCallback">
				<img src="../../../static/empt.png" alt="" v-if="mylist.length==0">
				<view class="card_items" :style="{'height':  tabCurrent==0  ?'600rpx':'350rpx'}"
					v-for="(item,index) in mylist" @click="toDetail(item)">
					<view class="contents">
						<view class="titles">
							<view class="task">
								{{item.itemName}}
							</view>
							<view class="Claim" @click.stop="taketask(item,index)" v-if="tabCurrent==0"
								:style="{'color': item.orderType == 0 ? '#fff' : '#363A44','background-color': item.orderType == 0 ? '#428FFC' : '#E8E9EC'}"
								:class="{'acclaim' :  this.index ==index }">
								{{item.orderType == 0 ? '认领' :'已认领' }}
							</view>
							<view class="Claim" @click.stop="taketask(item,index)" v-if="tabCurrent==1"
								:style="{'color': item.isClosed == 0 ? '#428FFC' : item.isClosed == 1  ? '#00D0CE' :'' }">
								{{item.isClosed == 0 ? '进行中' : item.isClosed == 1 ?  '完结' : '关闭' }}
							</view>
						</view>
						<view class="tips">

						</view>
						<view class="item">
							<view class="field">
								当前审核进度
							</view>
							<view class="content">
								{{item.nodeName || '暂无'  }}
							</view>
						</view>
						<view class="item">
							<view class="field">
								{{item.itemName =='运输企业申请'  ? '企业名称' : item.itemName =='出土项目申报'  ? '出土项目名称' :item.itemName =='停车场申请' ? '停车场名称' : item.itemName =='场地出土申报' ? '出土项目名称' :  item.itemName =='车辆增加申请' || item.itemName =='车辆删减申请' || item.itemName =='驾驶员新增申请'|| item.itemName =='车辆变更申请' || item.itemName =='船舶注册申请' ? '企业名称' :  '消纳点名称'  }}
							</view>
							<view class="content">
								{{item.name || '暂无名称'}}
							</view>
						</view>
						<view class="item">
							<view class="field">
								审核申报时间
							</view>
							<view class="content">
								{{item.dispatchTime}}
							</view>
						</view>
						<view class="line" v-if="tabCurrent==0"></view>
						<view class="" v-if="tabCurrent==0">
							<view style="font-size: 32rpx;color: #363A44;margin-top: 32rpx;">
								当前审核状态
							</view>
							<view class="steps" style="padding: 36rpx;" v-if="item.itemName=='出土项目申报'">
								<steps :steps="numList" :current="item.stepsnumber"></steps>
								<!-- <u-steps :list="numList" :current="item.stepsnumber" mode="dot"></u-steps> -->
							</view>
							<view class="steps" style="padding: 36rpx;"
								v-else-if="item.itemName=='停车场申请' || item.itemName=='运输企业申请' ">
								<steps :steps="numList2" :current="1"></steps>
								<!-- <u-steps :list="numList2" current="1" mode="dot"></u-steps> -->
							</view>
							<view class="steps" style="padding: 36rpx;" v-else-if="item.itemName=='消纳审核（矿坑）'">
								<steps :steps="numList3" :current="item.stepsnumber3"></steps>
								<!-- <u-steps :list="numList3" :current="item.stepsnumber3" mode="dot"></u-steps> -->
							</view>
							<view class="steps" style="padding: 36rpx;" v-else-if="item.itemName=='消纳审核（工程类）'">
								<steps :steps="numList4" :current="item.stepsnumber4"></steps>
								<!-- <u-steps :list="numList3" :current="item.stepsnumber3" mode="dot"></u-steps> -->
							</view>
							<view class="steps" style="padding: 36rpx;"
								v-else-if="item.itemName=='车辆增加申请' || item.itemName=='车辆删减申请'|| item.itemName=='驾驶员新增申请'|| item.itemName =='车辆变更申请'">
								<steps :steps="numList5" :current="1"></steps>
								<!-- <u-steps :list="numList3" :current="item.stepsnumber3" mode="dot"></u-steps> -->
							</view>
							<view class="steps" style="padding: 36rpx;" v-else-if="item.itemName=='船舶注册申请'">
								<steps :steps="numList6" :current="1"></steps>
								<!-- <u-steps :list="numList3" :current="item.stepsnumber3" mode="dot"></u-steps> -->
							</view>
							<view class="steps" style="padding: 36rpx;" v-else>
								<steps :steps="numList1" :current="item.stepsnumber1"></steps>
								<!-- <u-steps :list="numList1" :current="item.stepsnumber1" mode="dot"></u-steps> -->
							</view>
						</view>

						<!-- 	<view class="line"></view>
					<view class="" >
						<u-cell-item :label='value2' title="查看审核详情" :arrow="true" arrow-direction="down"></u-cell-item>
					</view> -->
					</view>
				</view>
			</mescroll-list>
			<mescroll-list :fixed="false" :down="mescrollDown" :up="mescrollUp" ref="mescrollRef" @init="mescrollInit"
				v-if="tabCurrent==1" @down="downCallback" @up="upCallback">
				
				<view class="" style="display: flex;justify-content: flex-end;" @click="showPass=true" >
					<view class="" style="background-color: #007AFF;padding: 10rpx;width: 100rpx;border-radius: 10rpx;color: #FFFFFF;margin-right: 25rpx;text-align: center;" >
						筛选
					</view>
					
				</view>
				<!-- 审核通过弹窗 -->
				<u-popup v-model="showPass" mode="top " mask>
					<view class="searchArea">
						<!-- 筛选 -->
							<his-search-com :searchForm="searchForm" @showCalendar="showCalendar" 
							@confirmSearch="confirmSearch" @resetSearch="resetSearch" @chooseStatusClick='chooseStatusClick' ></his-search-com>	
					</view>
				</u-popup>
				<!-- <img src="../../../static/empt.png" alt="" v-if="mylist1.length==0"> -->
				<view class="card_items" :style="{'height':  tabCurrent==0  ?'600rpx':'350rpx'}"
					v-for="(item,index) in mylist1" @click="toDetail(item)">
					<view class="contents">
						<view class="titles">
							<view class="task">
								{{item.itemName}}
							</view>
							<view class="Claim" @click.stop="taketask(item,index)" v-if="tabCurrent==0"
								:style="{'color': item.orderType == 0 ? '#fff' : '#363A44','background-color': item.orderType == 0 ? '#428FFC' : '#E8E9EC'}"
								:class="{'acclaim' :  this.index ==index }">
								{{item.orderType == 0 ? '认领' :'已认领' }}
							</view>
							<view class="Claim" @click.stop="taketask(item,index)" v-if="tabCurrent==1"
								:style="{'color': item.isClosed == 0 ? '#428FFC' : item.isClosed == 1  ? '#00D0CE' :'' }">
								{{item.isClosed == 0 ? '进行中' : item.isClosed == 1 ?  '完结' : '关闭' }}
							</view>
						</view>
						<view class="tips">

						</view>
						<view class="item">
							<view class="field">
								当前审核进度
							</view>
							<view class="content">
								{{item.nodeName || '暂无'  }}
							</view>
						</view>
						<view class="item">
							<view class="field">
								{{item.itemName =='运输企业申请'  ? '企业名称' : item.itemName =='出土项目申报'  ? '出土项目名称' :item.itemName =='停车场申请' ? '停车场名称' : item.itemName =='场地出土申报' ? '出土项目名称' :  item.itemName =='车辆增加申请' || item.itemName =='车辆删减申请' || item.itemName =='驾驶员新增申请'|| item.itemName =='驾驶员删减申请' || item.itemName =='车辆变更申请'? '企业名称' :  '消纳点名称'  }}
							</view>
							<view class="content">
								{{item.name || '暂无名称'}}
							</view>
						</view>
						<view class="item">
							<view class="field">
								审核申报时间
							</view>
							<view class="content">
								{{item.dispatchTime}}
							</view>
						</view>
						<view class="line" v-if="tabCurrent==0"></view>
						<view class="" v-if="tabCurrent==0">
							<view style="font-size: 32rpx;color: #363A44;margin-top: 32rpx;">
								当前审核状态
							</view>
							<view class="steps" style="padding: 36rpx;" v-if="item.itemName=='出土项目申报'">
								<steps :steps="numList" :current="item.stepsnumber"></steps>
								<!-- <u-steps :list="numList" :current="item.stepsnumber" mode="dot"></u-steps> -->
							</view>
							<view class="steps" style="padding: 36rpx;"
								v-else-if="item.itemName=='停车场申请' || item.itemName=='运输企业申请' ">
								<steps :steps="numList2" :current="1"></steps>
								<!-- <u-steps :list="numList2" current="1" mode="dot"></u-steps> -->
							</view>
							<view class="steps" style="padding: 36rpx;" v-else-if="item.itemName=='消纳审核（矿坑）'">
								<steps :steps="numList3" :current="item.stepsnumber3"></steps>
								<!-- <u-steps :list="numList3" :current="item.stepsnumber3" mode="dot"></u-steps> -->
							</view>
							<view class="steps" style="padding: 36rpx;" v-else-if="item.itemName=='消纳审核（工程类）'">
								<steps :steps="numList4" :current="item.stepsnumber4"></steps>
								<!-- <u-steps :list="numList3" :current="item.stepsnumber3" mode="dot"></u-steps> -->
							</view>
							<view class="steps" style="padding: 36rpx;" v-else>
								<steps :steps="numList1" :current="item.stepsnumber1"></steps>
								<!-- <u-steps :list="numList1" :current="item.stepsnumber1" mode="dot"></u-steps> -->
							</view>
						</view>

						<!-- 	<view class="line"></view>
					<view class="" >
						<u-cell-item :label='value2' title="查看审核详情" :arrow="true" arrow-direction="down"></u-cell-item>
					</view> -->
					</view>
				</view>
				
			</mescroll-list>
		</view>
		<!-- 日历 -->
		<u-calendar v-model="calendar_show" mode="range" :end-date="'2099-5-20'" :safe-area-inset-bottom="true" @change="calendarValueChange"></u-calendar>
		<u-toast ref="uToast" />
	</view>
</template>
<script>
	import lauwenSelect from "@/components/lauwen-select/lauwenSelect.vue"
	import {
		getMyList,
		getTodoHis,
		getWordOrder,
		getTakeTask
	} from "@/pages/api/orderp/orderp.js"
	import mescrollList from '@/components/mescroll-uni/mescroll-list.vue'
	import mescrollMixins from '@/components/mescroll-uni/mescroll-mixins.js'
	import hisSearchCom from '@/components/hisSearchCom.vue'
	import steps from '@/components/orderStep/orderStep.vue';
	import vTbas from '@/components/v-tabs/v-tabs.vue'
	import {
		mapMutations
	} from "vuex";
	export default {
		mixins: [mescrollMixins],
		components: {
			lauwenSelect,
			mescrollList,
			steps,
			hisSearchCom,
			vTbas
		},
		created() {
			uni.$on('updatelist', num => {
				this.index = []
				this.MyList()
			})
		},
		onLoad(op) {
			console.log('index页面的op', op)
			this.loading = true
			if (this.$store.state.tab_flag == 1) {
				this.tabCurrent = 1
				this.mylist = []
				this.todoHis()
			} else {
				this.tabCurrent = 0
				this.MyList()
			}
		},
		onShow() {
			this.MyList()
		},
		onBackPress(event) {
			console.log(event)
			uni.redirectTo({
				url: '/pages/index/index'
			})
		},
		data() {
			return {
				options: {
					0: '审核中',
					1: '已审核',
				},
				value1: 1,
				value2: 2,
				mylist: [],
				isDelay: '',
				numList: [{
						name: '提交申请'
					}, {
						name: '现场踏勘'
					}, {
						name: '部门审核'
					},
					{
						name: '渣土办审核'
					}
				],
				numList1: [{
					name: '提交申请'
				}, {
					name: '消纳审核'
				}, {
					name: '运输企业'
				}, {
					name: '渣土办'
				}, {
					name: '交警审核'
				}],
				numList2: [{
					name: '提交申请'
				}, {
					name: '部门审核'
				}],
				numList3: [{
					name: '提交申请'
				}, {
					name: '初步审核'
				}, {
					name: '联合踏勘'
				}, {
					name: '初步方案'
				}, {
					name: '联合会审'
				}, {
					name: '渣土办审核'
				}],
				numList4: [{
					name: '提交申请'
				}, {
					name: '现场踏勘'
				}, {
					name: '部门审核'
				}, {
					name: '自规局审核'
				}, {
					name: '渣土办审核'
				}],
				// 车辆增加申请
				numList5: [{
					name: '提交申请'
				}, {
					name: '部门审核'
				}],
				// 船舶注册申请
				numList6: [{
					name: '提交申请'
				}, {
					name: '港航审核'
				}],
				index: [],
				checkop: '',
				tabCurrent: 0,
				tabList: ['审核中', '已审核'],
				loading: false,
				mescrollUp: {
					auto: false,
					textNoMore: '-- 已加载所有 --'
				},
				mescrollDown: {
					auto: false
				},
				mylistsize: 10,
				todosize: 10,
				mylistlength: 0,
				todolength: 0,
				mylist1: '',
				searchForm:{
					inputValue:'',
					date:'',
					itemId:'',
					resStatus:''
				},
				calendar_show:false,
				startT:'',
				endT:'',
				showPass:false,
				itemId:''
			}
		},
		methods: {
			...mapMutations('mdOrder', ['setOrderIdSp']),
			//下拉刷新
			downCallback(e) {
				if (this.tabCurrent == 0) {
					this.mylistsize = 10
					this.MyList().then(res => {
						e.endSuccess(res.length, res.length + 10 > this.mylistsize);
					})
				} else {
					this.todosize = 10
					this.todoHis().then(res => {
						e.endSuccess(res.length, res.length + 10 > this.todosize);
					})
				}
			},
			//上拉加载
			upCallback(e) {
				if (this.tabCurrent == 0) {
					this.mylistsize += 10
					this.MyList().then(res => {
						e.endSuccess(res.length, res.length + 10 > this.mylistsize);
					})
				} else {
					this.todosize += 10
					this.todoHis().then(res => {
						e.endSuccess(res.length, res.length + 10 > this.todolength);
					})
				}
			},
			tabChange(index) {

				console.log(index)
				if (index == 1) {
					console.log(this.mescroll)
					// this.loading=true
					this.todosize = 10
					this.todoHis().then(res => {
						this.tabCurrent = index
						// this.mescroll.triggerDownScroll();
					})

				} else {
					this.mylistsize = 10
					this.MyList().then(res => {
						this.tabCurrent = index
						// this.mescroll.triggerDownScroll();
					})

				}
			},
			todoHis() {
				let params = {
					isDelay: this.isDelay,
					size: this.todosize,
					sceneName: '工程渣土业务审批',
					title:this.searchForm.inputValue,
					startTime:this.startT,
					endTime:this.endT,
					itemId:this.itemId
				}
				return new Promise((resolve, reject) => {
					getTodoHis(params).then(res => {
						console.log('已审核', res.rows)
						this.mylist1 = res.rows
						this.mylist1.forEach(d => {
							d.name = d.title
							let checkop = 0
							d.stepsnumber1 = 1
							if (d.type == 1 && d.params) {
								d.checkop = d.params.checkOptions[0]
								checkop = d.params.checkOptions[0]
								if (d.params.checkOptions[0] == 2) {
									d.stepsnumber = 3
								} else if (d.params.checkOptions[0] == 1) {
									d.stepsnumber3 = 1
									d.stepsnumber = 1
								} else { //消纳
									if (d.orderType == 0) { //未认领
										d.stepsnumber4 = 1
										d.xiaonaEdit = -1
									} else {
										d.stepsnumber4 = 1
										d.xiaonaEdit = 1 //是否可编辑 1可编辑 
									}
								}
							}
							if (d.type == 3 && d.params) {
								d.checkop = d.params.auditOptions[0]
								if (d.checkop == 1) {
									d.stepsnumber1 = 1
									d.stepsnumber4 = 3
									if (d.orderType == 1) {
										d.xiaonaEdit2 = 1 // 在自规局审核且已经认领地图可编辑
									}
								} else if (d.checkop == 2) {
									d.stepsnumber = 3
									d.stepsnumber1 = 2
									d.stepsnumber4 = 4
								} else if (d.checkop == 3) {
									d.stepsnumber1 = 3
									d.stepsnumber3 = 3
								} else if (d.checkop == 4) {
									d.stepsnumber1 = 4
								} else if (d.checkop == 5) {
									d.stepsnumber3 = 5
								}
							}
							if (d.type == 1 && d.orderType == 0 && checkop == 1) { //任务未认领
								d.stepsnumber = 1
								d.checkop = -1
							}
							if ((d.type == 10 || d.type == 11) && d.orderType == 0) {
								d.stepsnumber = 1
								d.stepsnumber1 = 0
								d.stepsnumber3 = 1
								d.stepsnumber4 = 1
								if (d.nodeName == '联合会审') d.stepsnumber3 = 4
							} else if (d.type == 10 && d.orderType == 1) {
								d.stepsnumber = 1
								d.stepsnumber1 = 1
								d.stepsnumber3 = 1
								d.stepsnumber4 = 1
								if (d.nodeName == '联合会审') d.stepsnumber3 = 4
							} else if (d.type == 11 && d.orderType == 1) {
								d.stepsnumber = 2
								d.stepsnumber3 = 2
								d.stepsnumber1 = 1
								d.stepsnumber4 = 2
								if (d.nodeName == '联合会审') d.stepsnumber3 = 4
							}
						})
						this.todolength = res.rows.length
						this.loading = false
						resolve(res.rows)
					}).catch(err => {
						reject(err)
					})
				})
			},
			MyList() {
				//  type 0-新建，1-核验，2-处置，3-审核, 4-转派, 5-上提, 6-退单, 7-结案 ,8-关闭, 9-抄送，10-分派，11-分派中
				let params = {
					isDelay: this.isDelay,
					size: this.mylistsize,
					sceneName: '工程渣土业务审批'
					// itemId: "402887ae7b62cd4f017b62ef1f4c0170,402887ae7b1aca6f017b1b572b0e1913,402887ae7af5e872017af61c3812070f,402887ae7af5e872017af60b5a6f04a6,402887ae7ba05810017ba4f56512116d,402887ae7ba05810017ba55d71f6195a,402887ae7ba05810017ba55c4a501939,402887ae7ba05810017ba553d16e185e,402887ae7ba05810017ba558ec9b18dd,402887ae7ba05810017ba0ccce6606a0,402887ae7ba05810017ba0ccce6606a0"
					// itemId: "402887ae7b62cd4f017b62ef1f4c0170"
				}
				return new Promise((resolve, reject) => {
					getMyList(params).then(res => {
						console.log('mylist', res)
						this.mylist = res.rows
						this.mylistlength = res.rows.length
						this.mylist.forEach(d => {
							// d.name = d.formValue[0].orderName
							d.name = d.title
							let checkop = 0
							d.stepsnumber1 = 1
							if (d.type == 1 && d.params) {
								d.checkop = d.params.checkOptions[0]
								checkop = d.params.checkOptions[0]
								if (d.params.checkOptions[0] == 2) {
									d.stepsnumber = 3
								} else if (d.params.checkOptions[0] == 1) {
									d.stepsnumber3 = 1
									d.stepsnumber = 1
								} else { //消纳
									if (d.orderType == 0) { //未认领
										d.stepsnumber4 = 1
										d.xiaonaEdit = -1
									} else {
										d.stepsnumber4 = 1
										d.xiaonaEdit = 1 //是否可编辑 1可编辑 
									}
								}
							}
							if (d.type == 3 && d.params) {
								d.checkop = d.params.auditOptions[0]
								if (d.checkop == 1) { //自规局审核
									d.stepsnumber1 = 1
									d.stepsnumber4 = 3
									d.xiaonaEdit = -1
									if (d.orderType == 1) {
										d.xiaonaEdit2 = 1 // 在自规局审核且已经认领地图可编辑
									}
								} else if (d.checkop == 2) { //渣土办审核
									d.stepsnumber = 3
									d.stepsnumber1 = 2
									d.stepsnumber4 = 4
									d.xiaonaEdit = -1
								} else if (d.checkop == 3) {
									d.stepsnumber1 = 3
									d.stepsnumber3 = 3
								} else if (d.checkop == 4) {
									d.stepsnumber1 = 4
								} else if (d.checkop == 5) {
									d.stepsnumber3 = 5
								}
							}
							if (d.type == 1 && d.orderType == 0 && checkop == 1) { //任务未认领
								d.stepsnumber = 1
								d.checkop = -1
							}
							if ((d.type == 10 || d.type == 11) && d.orderType == 0) {
								d.stepsnumber = 1
								d.stepsnumber1 = 0
								d.stepsnumber3 = 1
								d.stepsnumber4 = 1
								d.xiaonaEdit = -1
								if (d.nodeName == '联合会审') d.stepsnumber3 = 4
							} else if (d.type == 10 && d.orderType == 1) { //已通过未分配部门
								d.stepsnumber = 1
								d.stepsnumber1 = 1
								d.stepsnumber3 = 1
								d.stepsnumber4 = 1
								d.xiaonaEdit = -1 //是否可编辑
								if (d.nodeName == '联合会审') d.stepsnumber3 = 4
							} else if (d.type == 11 && d.orderType == 1) {
								d.stepsnumber = 2
								d.stepsnumber3 = 2
								d.stepsnumber1 = 1
								d.stepsnumber4 = 2
								d.xiaonaEdit = -1
								if (d.nodeName == '联合会审') d.stepsnumber3 = 4
							}
						})
						// this.mylist = res.rows
						this.loading = false
						resolve(res.rows)
					}).catch(err => {
						reject(err)
					})
				})
			},
			//详情页
			toDetail(item) {
				// uni.navigateTo({
				// 	url: '/pages/index/approval/car/addCar?id=' + item.recordId + urls + '&stepsnumber=' + item
				// 		.stepsnumber
				// })
				// return
				this.setOrderIdSp(item.id)
				this.$store.state.tab_flag = this.tabCurrent
				let urls = '&checkop=' + item.checkop + '&currenttab=' + this.tabCurrent + '&nodeId=' + item.nodeId +
					'&idd=' + item.id + '&nodeName=' + item.nodeName
				console.log(item.stepsnumber)
				switch (item.itemName) {
					case "出土项目申报":
						uni.navigateTo({
							url: '/pages/index/approval/chutu/detail?id=' + item.recordId + urls +
								'&stepsnumber=' +
								item.stepsnumber
						})
						break;
					case "停车场申请":
						uni.navigateTo({
							url: '/pages/index/approval/parking?id=' + item.recordId + urls + '&stepsnumber=' +
								item
								.stepsnumber1
						})
						break;
					case "消纳审核（工程类）":
						uni.navigateTo({
							url: '/pages/index/approval/xiaona/xn?id=' + item.recordId + urls + '&stepsnumber=' +
								item
								.stepsnumber4 + '&xiaonaEdit=' + item.xiaonaEdit + '&xiaonaEdit2=' + item
								.xiaonaEdit2
						})
						break;
					case "消纳审核（矿坑）":
						uni.navigateTo({
							url: '/pages/index/approval/xiaona/kk?id=' + item.recordId + '&audit=kk' + urls +
								'&stepsnumber=' + item.stepsnumber3
						})
						break;
					case "运输企业申请":
						uni.navigateTo({
							url: '/pages/index/approval/qiye/qiye?id=' + item.recordId + '&audit=qiye' + urls
						})
						break;
					case "场地出土申报":
						uni.navigateTo({
							url: '/pages/index/approval/yunshurenwu?id=' + item.recordId + urls + '&stepsnumber=' +
								item.stepsnumber1
						})
						break;
					case "车辆增加申请":
						uni.navigateTo({
							url: '/pages/index/approval/car/addCar?id=' + item.recordId + urls + '&title=' + item
								.title + '&stepsnumber=' + 1
						})
						break;
					case "车辆删减申请":
						uni.navigateTo({
							url: '/pages/index/approval/car/deleteCar?id=' + item.recordId + urls + '&title=' +
								item.title + '&stepsnumber=' + 1
						})
						break;
					case "驾驶员新增申请":
						uni.navigateTo({
							url: '/pages/index/approval/driver/addDriver?id=' + item.recordId + urls + '&title=' +
								item.title + '&stepsnumber=' + 1
						})
						break;
					case "驾驶员删减申请":
						uni.navigateTo({
							url: '/pages/index/approval/driver/deleteDriver?id=' + item.recordId + urls +
								'&title=' +
								item.title + '&stepsnumber=' + 1
						})
						break;
					case "车辆变更申请":
						uni.navigateTo({
							url: '/pages/index/approval/car/updateCar?id=' + item.recordId + urls + '&title=' +
								item.title + '&stepsnumber=' + 1
						})
						break;
					case "船舶注册申请":
						uni.navigateTo({
							url: '/pages/index/approval/vessel/addVessel?id=' + item.recordId + urls + '&title=' +
								item.title + '&stepsnumber=' + 1
						})
						break;
					default:
				}
			},
			//切换筛选
			getValue(e) {
				console.log(e)
				if (e == 1) {

				} else if (e == 2) {

					this.isDelay = 1
					this.MyList()
				} else {
					this.isDelay = ''
					this.MyList()
				}
			},
			// 显示日历
			showCalendar() {
				console.log(this.calendar_show)
				this.calendar_show = true
			},
			// 日历点击确定
			calendarValueChange(value) {
				console.log(value)
				if(value.startDate==value.endDate){
					this.searchForm.date = value.startDate
					this.startT = value.startDate + ' 00:00:00'
					this.endT = value.startDate + ' 23:59:59'
				}else{
					this.searchForm.date = `${value.startDate}至${value.endDate}`
					this.startT = value.startDate + ' 00:00:00'
					this.endT = value.endDate + ' 23:59:59'
				}
				
			},
			//重置按钮点击
			resetSearch(){
				console.log(11)
				this.searchForm = {
					date: '', inputValue: ''
				}
			},
			// 下拉筛选框确认, 将搜索组件查询条件赋予列表查询条件, 然后重新加载列表
			confirmSearch(e) {
				console.log(e)
				this.searchForm.inputValue = e
				this.pageNum = 0
				this.showPass = false
				this.earthquakeList = []
				this.mescroll.resetUpScroll(true)
			},
			//任务认领
			taketask(item, index) {
				if (item.orderType == 0) {
					this.$store.state.tab_flag = this.tabCurrent
					uni.showModal({
						title: '提示',
						content: '是否确定领取？',
						confirmText: '确定',
						cancelText: '取消',
						success: res => {
							if (res.confirm) {
								getTakeTask({
									id: item.recordId
								}).then(res => {
									console.log('认领', item.stepsnumber)
									this.index = index
									let urls = ''
									switch (item.itemName) {
										case "出土项目申报":
											urls = '/pages/index/approval/chutu/detail?id=' + item
												.recordId +
												'&nodeId=' + item.nodeId +
												'&idd=' + item.id + '&checkop=' + (item.type == 1 ? 1 :
													3) +
												'&nodeName=' + item.nodeName + '&currenttab=' + this
												.tabCurrent + '&stepsnumber=' + (item.type == 1 ? 1 :
													3)
											break;
										case "停车场申请":
											urls = '/pages/index/approval/parking?id=' + item
												.recordId +
												'&nodeId=' +
												item.nodeId + '&idd=' + item.id + '&checkop=' + item
												.checkop + '&nodeName=' + item.nodeName +
												'&currenttab=' +
												this.tabCurrent + '&stepsnumber=' + item.stepsnumber1
											break;
										case "消纳审核（工程类）":
											urls = '/pages/index/approval/xiaona/xn?id=' + item
												.recordId +
												'&nodeId=' + item
												.nodeId + '&idd=' + item.id + '&checkop=' + item
												.checkop +
												'&nodeName=' + item.nodeName + '&currenttab=' + this
												.tabCurrent + '&stepsnumber=' + (item.type == 1 ? 1 :
													item
													.type == 3 ? item.params.auditOptions[0] == 1 ? 3 :
													4 :
													2) + '&xiaonaEdit=' + (item.type == 1 ? 1 : -1) +
												'&xiaonaEdit2=' + item.xiaonaEdit2
											break;
										case "消纳审核（矿坑）":
											urls = '/pages/index/approval/xiaona/kk?id=' + item
												.recordId +
												'&nodeId=' + item.nodeId +
												'&idd=' + item.id + '&kk=true' + '&checkop=' + item
												.checkop + '&nodeName=' + item.nodeName +
												'&currenttab=' +
												this.tabCurrent + '&stepsnumber=' + item.stepsnumber3
											break;
										case "运输企业申请":
											urls = '/pages/index/approval/qiye/qiye?id=' + item
												.recordId +
												'&nodeId=' + item.nodeId +
												'&idd=' + item.id + '&audit=qiye' + '&checkop=' + item
												.checkop + '&nodeName=' + item.nodeName +
												'&currenttab=' +
												this.tabCurrent
											break;
										case "场地出土申报":
											urls = '/pages/index/approval/yunshurenwu?id=' + item
												.recordId + '&nodeId=' + item
												.nodeId + '&idd=' + item.id + '&checkop=' + item
												.checkop +
												'&nodeName=' + item.nodeName + '&checkop=' + item
												.checkop +
												'&currenttab=' + this.tabCurrent + '&stepsnumber=' +
												item.stepsnumber1
											break;
										case "船舶注册申请":
											urls = '/pages/index/approval/vessel/addVessel?id=' + item
												.recordId + '&nodeId=' + item
												.nodeId + '&idd=' + item.id + '&checkop=' + item
												.checkop +
												'&nodeName=' + item.nodeName + '&checkop=' + item
												.checkop +
												'&currenttab=' + this.tabCurrent + '&stepsnumber=' + 1
											break;
										default:
									}

									this.index = []
									this.MyList()

									this.$refs.uToast.show({
										title: '认领成功！',
										type: 'success',
										duration: 500,
										url: urls
									})
								}).catch((res) => {
									this.index = []
									this.MyList()
									this.$refs.uToast.show({
										title: res.data.msg,
										type: 'warning'
									}, 300)
								})
							}
						}
					});

				}

			},
			//
			chooseStatusClick(item){
					this.searchForm.resStatus = item.name
					this.itemId = item.id
			},
		}
	}
</script>

<style lang="scss" scoped>
	.approval {
		background-color: #F2F3F5;
		height: 100vh;
		width: 750rpx;

		// .cell_item {
		// 	background-color: #FFFFFF;
		// 	width: 750rpx;
		// 	height: 80rpx;
		// 	font-size: 29rpx;
		// 	color: #363A44;
		// 	border-top: 1.5rpx solid #DBDBDB;
		// 	border-bottom: 1.5rpx solid #DBDBDB;
		// }
		.main {
			padding-top: 106rpx;
			.searchArea{
			padding: 20rpx 0;
			display: flex;
			justify-content: center;
			}
			.card_items {
				margin: 26rpx;
				height: 600rpx;
				width: 686rpx;
				background-color: #FFFFFF;
				border-left: 13rpx solid #428FFC;
				border-top-left-radius: 10rpx;
				border-bottom-left-radius: 10rpx;
				box-shadow: 0 2px 8px 0 rgba(0, 0, 0, 0.12);

				.contents {
					padding: 32rpx;

					.titles {
						display: flex;
						justify-content: space-between;

						.task {
							color: #428FFC;
							font-size: 36rpx;
							font-weight: 800;
						}

						.Claim {
							z-index: 9;
							text-align: center;
							height: 48rpx;
							width: 148rpx;
							font-size: 28rpx;
							line-height: 48rpx;

						}

						.acclaim {
							background-color: #E8E9EC;
							color: #363A44;
						}
					}

					.tips {
						color: #428FFC;
						font-weight: 600;
						font-size: 28rpx;
						margin-top: 16rpx;
					}

					.line {
						margin-top: 32rpx;
						height: 1px;
						width: 100%;
						background-color: #E8E9EC;
					}

					.item {
						display: flex;
						margin-top: 32rpx;
						font-size: 32rpx;

						.field {
							width: 212rpx;
							color: #B3B5B9;
							margin-right: 32rpx;
						}

						.content {
							overflow: hidden;
							text-overflow: ellipsis;
							display: -webkit-box;
							-webkit-line-clamp: 2;
							-webkit-box-orient: vertical;
							word-wrap: break-word;
							width: 400rpx;
							color: #363A44;
						}
					}
				}
			}
		}

	}

	.tabList {
		height: 80rpx;
		width: 750rpx;
		z-index: 100;
		position: fixed;
		top: 0rpx;
		background-color: #FFFFFF;
		border-bottom: .5rpx solid #DBDBDB;
	}

	.steps {
		margin-left: -50rpx;
		width: 100%;
		overflow: hidden;
	}
</style>
